package br.com.wepa.webapps.orca.logica.negocio.facade;

import br.com.wepa.webapps.logger.TraceLogger;
import br.com.wepa.webapps.orca.logica.modelo.Fornecedor;
import br.com.wepa.webapps.orca.logica.modelo.Uf;
import br.com.wepa.webapps.orca.logica.negocio.BusinessException;
import br.com.wepa.webapps.orca.logica.negocio.BusinessManager;
import br.com.wepa.webapps.orca.logica.negocio.facade.to.FornecedorTO;
import br.com.wepa.webapps.orca.logica.persistencia.FornecedorDAO;

class FornecedorFacade extends BusinessManager<FornecedorTO,Fornecedor, Integer, FornecedorDAO> implements FornecedorFacadeHome {
	private static TraceLogger logger  = new TraceLogger(FornecedorFacade.class);
	
	
	@Override
	public FornecedorTO find(FornecedorTO to) throws BusinessException {
		to.addOrder("nome", true);
		return super.find(to);
	}
	
	@Override
	public FornecedorTO findAll(FornecedorTO to) throws BusinessException {
		to.addOrder("nome", true);
		return super.findAll(to);
	}
		
	
	@SuppressWarnings("unchecked")
	@Override
	public FornecedorTO setUp(FornecedorTO to) throws BusinessException {
		logger.entering();
		to.enableSearcher();
		to.getSearcher().addSearchBean("ufList", new Uf());
		to = super.setUp(to);
		
		logger.exiting();
		return to;
	}
	
}
